<html>
<head><meta charset="utf-8"><title>recursive impl Trait · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html">recursive impl Trait</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="246982626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246982626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246982626">(Jul 23 2021 at 14:13)</a>:</h4>
<p>one thing I was thinking about -- not directly relted to this -- was recursive functions</p>



<a name="246982650"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246982650" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246982650">(Jul 23 2021 at 14:13)</a>:</h4>
<p>right now if you have a recursive impl Trait function, you get a cycle error</p>



<a name="246982664"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246982664" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246982664">(Jul 23 2021 at 14:13)</a>:</h4>
<p>if we had some of the infrstructure I'm building in salsa to support chalk, though, we could handle cycles more elegantly, and I think we could handle recursion too</p>



<a name="246982747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246982747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246982747">(Jul 23 2021 at 14:14)</a>:</h4>
<p>(sorry, I'm mixing in a bit of "long term impl Trait" thinking)</p>



<a name="246982752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246982752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246982752">(Jul 23 2021 at 14:14)</a>:</h4>
<p>I should start writing up the skill tree :P</p>



<a name="246982754"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246982754" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246982754">(Jul 23 2021 at 14:14)</a>:</h4>
<p>hehe</p>



<a name="246982771"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246982771" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246982771">(Jul 23 2021 at 14:14)</a>:</h4>
<p>(really, the "traits vision doc")</p>



<a name="246982790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246982790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246982790">(Jul 23 2021 at 14:14)</a>:</h4>
<p>which reminds me that once we ship TAITs, I want to talk to you about <del>a</del> the const generics vision doc</p>



<a name="246982802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246982802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246982802">(Jul 23 2021 at 14:15)</a>:</h4>
<p>now I'm <em>really</em> off topic</p>



<a name="246982947"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246982947" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246982947">(Jul 23 2021 at 14:16)</a>:</h4>
<p>I think with lazy TAIT inference we may be able to solve recursion</p>



<a name="246982975"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246982975" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246982975">(Jul 23 2021 at 14:16)</a>:</h4>
<p>as we stop asking for the hidden type and just generate inference variables</p>



<a name="246983064"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246983064" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246983064">(Jul 23 2021 at 14:17)</a>:</h4>
<p>of course that may run into an inference problem if you don't constrain it elsewhere, but that is expected</p>



<a name="246983072"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246983072" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246983072">(Jul 23 2021 at 14:17)</a>:</h4>
<p>well</p>



<a name="246983249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246983249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246983249">(Jul 23 2021 at 14:18)</a>:</h4>
<p>that's a good point, we can handle direct recursion</p>



<a name="246983260"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246983260" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246983260">(Jul 23 2021 at 14:18)</a>:</h4>
<p>not indirect I don't think</p>



<a name="246983295"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246983295" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246983295">(Jul 23 2021 at 14:19)</a>:</h4>
<p>but if foo calls itself, it may indeed "just work" (and that might be a user visible difference...)</p>



<a name="246983331"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246983331" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246983331">(Jul 23 2021 at 14:19)</a>:</h4>
<p>actually</p>



<a name="246983359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246983359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246983359">(Jul 23 2021 at 14:19)</a>:</h4>
<p>I guess there's another user visible difference, potentially</p>



<a name="246983409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246983409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246983409">(Jul 23 2021 at 14:20)</a>:</h4>
<p>consider this</p>



<a name="246983498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246983498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246983498">(Jul 23 2021 at 14:20)</a>:</h4>
<p>oh, nm</p>



<a name="246983518"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246983518" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246983518">(Jul 23 2021 at 14:20)</a>:</h4>
<p>I was thinking of this example, but of course it's not stable</p>



<a name="246983600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246983600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246983600">(Jul 23 2021 at 14:21)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">type</span> <span class="nc">A</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">impl</span><span class="w"> </span><span class="n">Debug</span><span class="p">;</span><span class="w"></span>
<span class="k">type</span> <span class="nc">B</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">impl</span><span class="w"> </span><span class="n">Debug</span><span class="p">;</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">x</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="nc">A</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">y</span><span class="p">()</span><span class="w"> </span><span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">y</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="nc">B</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">x</span><span class="p">()</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="246983666"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246983666" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246983666">(Jul 23 2021 at 14:21)</a>:</h4>
<p>heh, wonder what we want to happen here</p>



<a name="246983756"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246983756" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246983756">(Jul 23 2021 at 14:22)</a>:</h4>
<p>this is guaranteed unknown, unless another function constrains either A or B</p>



<a name="246983765"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246983765" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246983765">(Jul 23 2021 at 14:22)</a>:</h4>
<p>in general the ideae of scoping type alias to module ... seems right, but like it will often not be what you want in practice</p>



<a name="246983796"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246983796" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246983796">(Jul 23 2021 at 14:22)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/144729-wg-traits/topic/recursive.20impl.20Trait/near/246983756">said</a>:</p>
<blockquote>
<p>this is guaranteed unknown, unless another function constrains either A or B</p>
</blockquote>
<p>yes, but what I was really worried about was I guess a slightly different case</p>



<a name="246983844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246983844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246983844">(Jul 23 2021 at 14:23)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">type</span> <span class="nc">A</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">impl</span><span class="w"> </span><span class="n">Debug</span><span class="p">;</span><span class="w"></span>
<span class="k">type</span> <span class="nc">B</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">impl</span><span class="w"> </span><span class="n">Debug</span><span class="p">;</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">x</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="nc">A</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="fm">println!</span><span class="p">(</span><span class="s">"{:?}"</span><span class="p">,</span><span class="w"> </span><span class="n">y</span><span class="p">());</span><span class="w"></span>
<span class="w">    </span><span class="mi">22</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">y</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="nc">B</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="mi">44</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="246983877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246983877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246983877">(Jul 23 2021 at 14:23)</a>:</h4>
<p>really this is just the "it'd be nice to be able to rely on the fact that <code>y(): Debug</code></p>



<a name="246983912"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246983912" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246983912">(Jul 23 2021 at 14:23)</a>:</h4>
<p>ah, even in the defining scope</p>



<a name="246983960"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246983960" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246983960">(Jul 23 2021 at 14:24)</a>:</h4>
<p>which I think we agreed to leave out of scope for now</p>



<a name="246983971"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246983971" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246983971">(Jul 23 2021 at 14:24)</a>:</h4>
<p>we do already have fallback logic in type inference</p>



<a name="246983973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246983973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246983973">(Jul 23 2021 at 14:24)</a>:</h4>
<p>beacuse it's clearly a future compatible improvement, and it applies in many other cases</p>



<a name="246983983"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246983983" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246983983">(Jul 23 2021 at 14:24)</a>:</h4>
<p>when it fails, fall back to the opaque type?</p>



<a name="246984007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246984007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246984007">(Jul 23 2021 at 14:24)</a>:</h4>
<p>that is not a good idea :)</p>



<a name="246984018"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246984018" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246984018">(Jul 23 2021 at 14:24)</a>:</h4>
<p>what I expect is:</p>



<a name="246984086"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246984086" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246984086">(Jul 23 2021 at 14:25)</a>:</h4>
<p>at some point we should consider it "ok" to leave the value of an <code>impl Trait</code> unconstrained</p>



<a name="246984105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246984105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246984105">(Jul 23 2021 at 14:25)</a>:</h4>
<p>so long as we can prove all trait obligations</p>



<a name="246984122"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246984122" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246984122">(Jul 23 2021 at 14:25)</a>:</h4>
<p>that simply means that <code>x</code> is not a "Defining use" (so to speak) of <code>A</code></p>



<a name="246984130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246984130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246984130">(Jul 23 2021 at 14:25)</a>:</h4>
<p>(well, in this case, <code>B</code>)</p>



<a name="246984165"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246984165" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246984165">(Jul 23 2021 at 14:26)</a>:</h4>
<p>yes, isn't that the same as what I said? XD</p>



<a name="246984233"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246984233" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246984233">(Jul 23 2021 at 14:26)</a>:</h4>
<p>well</p>



<a name="246984241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246984241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246984241">(Jul 23 2021 at 14:26)</a>:</h4>
<p>you talked about falling back</p>



<a name="246984245"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246984245" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246984245">(Jul 23 2021 at 14:26)</a>:</h4>
<p>we already have fallback for <code>fn foo(x: A) -&gt; A { x }</code></p>



<a name="246984275"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246984275" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246984275">(Jul 23 2021 at 14:26)</a>:</h4>
<p>yes, I am saying that this is a bad way to achieve that goal</p>



<a name="246984285"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246984285" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246984285">(Jul 23 2021 at 14:26)</a>:</h4>
<p>I'm calling it that, because that's what the code says</p>



<a name="246984292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246984292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246984292">(Jul 23 2021 at 14:26)</a>:</h4>
<p>ah heh</p>



<a name="246984296"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246984296" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246984296">(Jul 23 2021 at 14:26)</a>:</h4>
<p>I don't like that code :)</p>



<a name="246984395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246984395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246984395">(Jul 23 2021 at 14:27)</a>:</h4>
<p>but... how would you do it otherwise? You need to resolve the inference variable somehow, otherwise you get an inference error, right?</p>



<a name="246984515"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246984515" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246984515">(Jul 23 2021 at 14:28)</a>:</h4>
<p>sorry, I have to concentrate on this annoying "Press 1 for ..." menu right now :)</p>



<a name="246984537"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246984537" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246984537">(Jul 23 2021 at 14:28)</a>:</h4>
<p>XD</p>



<a name="246984575"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246984575" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246984575">(Jul 23 2021 at 14:28)</a>:</h4>
<p>I've been trying to navigate it while talking to you and I keep getting stuck in the wrong place :)</p>



<a name="246984622"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246984622" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246984622">(Jul 23 2021 at 14:29)</a>:</h4>
<p>well, we can continue this whenever you got your hands free again ^^</p>



<a name="246985878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246985878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246985878">(Jul 23 2021 at 14:40)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/144729-wg-traits/topic/recursive.20impl.20Trait/near/246984395">said</a>:</p>
<blockquote>
<p>but... how would you do it otherwise? You need to resolve the inference variable somehow, otherwise you get an inference error, right?</p>
</blockquote>
<p>while i'm on hold...this is correct, today. What I'm saying is that I think we can revisit this rule.</p>



<a name="246985937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246985937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246985937">(Jul 23 2021 at 14:40)</a>:</h4>
<p>I don't think we have to worry about it for now</p>



<a name="246985997"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/recursive%20impl%20Trait/near/246985997" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/recursive.20impl.20Trait.html#246985997">(Jul 23 2021 at 14:41)</a>:</h4>
<p>kk</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>